﻿using PMS.Data.Entities.Customers;
using PMS.Data.Entities.SystemModules;
using System.Collections.Generic;

namespace PMS.Services.Utils.Security
{
    /// <summary>
    /// 系统模块、模块按钮、及需要通过角色授权分配操作权限的功能进行权限授权操作
    /// 1：操作按钮原子化添加编辑，不与系统模块功能关联
    /// 2：系统模块通过分配按钮绑定页面功能中的操作按钮
    /// 3：通过系统模块权限分配指定每个系统模块及其分配按钮与角色的权限关系
    /// 4：按用户角色查询系统模块及其分配按钮的操作权限
    /// </summary>
    public partial interface IPermissionService
    {
        #region SystemModule
        bool AdminAuthorize(string hashId);
        /// <summary>
        /// Authorize permission of SystemModule(Navi Menu)
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="module"></param>
        /// <returns>true - authorized; otherwise, false</returns>
        bool AdminAuthorize(Customer customer, SystemModule module);

        #endregion

        #region SystemModuleButton
        /// <summary>
        /// 查询分配给系统模块的所有操作按钮是否有操作权限
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="module"></param>
        /// <returns>Lists of results with each assigned modulebuttonId and whether is authorized</returns>
        //IList<(int btnId, bool canAccess)> GetModuleAssignedButtonsWithAccess(Customer customer, SystemModule module);
        int[] GetModuleAssignedButtonIdsWithAccess(Customer customer, SystemModule module);
       
        /// <summary>
        /// 查询指定模块下的模块按钮是否有操作权限
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="buttonId"></param>
        /// <returns></returns>
        bool AdminModuleButtonAuthorize(int moduleId, int buttonId);
        #endregion
    }
}
